<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">

<head>
    <meta charset="UTF-8">
    <title>团队账号</title>
    <link href="__PUBLIC__/layui/css/layui.css" rel="stylesheet" />
    <link rel="stylesheet" href="__PUBLIC__/css/global.css" media="all">
    <link href="__PUBLIC__/Font-Awesome/css/font-awesome.css" rel="stylesheet" />
<!--    <script src="http://oss.sheetjs.com/js-xlsx/xlsx.full.min.js"></script>-->
    <script src="__PUBLIC__/js/xlsx.full.min.js"></script>
</head>

<body>
<div class="admin-main">
    <blockquote class="layui-elem-quote layui-form">
        <button  class="layui-btn layui-btn-small exceladd">
            <i class="layui-icon">&#xe608;</i> excel导入数据
        </button>
    </blockquote>
    <fieldset class="layui-elem-field">
        <legend>账号列表</legend>
        <div class="layui-field-box">
            <table class="layui-table">
                <thead>
                <tr>
                    <th>省份</th>
                    <th>城市</th>
                    <th>区域</th>
                    <th>身份证号</th>
                    <th>绑定用户邮箱</th>
                    <th>绑定用户密码</th>
                </tr>
                </thead>
                <tbody id="listcontent">
                </tbody>
            </table>
        </div>
    </fieldset>
    <div class="admin-table-page">
        <div id="page" class="page">
        </div>
    </div>
</div>
<div id="demo" style="display: none"></div>
<script id="listtpl" type="text/html">
    <tr>
        <td>{{d.u_privace}}</td>
        <td>{{d.u_city}}</td>
        <td>{{d.district}}</td>
        <td>{{d.u_card_id}}</td>
         <td><span>{{d.u_eamil}}</span></td>
        <td>{{ d.u_pwd}}</td>
    </tr>
</script>
<script type="text/javascript" src="__PUBLIC__/layui/layui.js"></script>
<script>
    var form,layer,$,laydate;
    layui.use(['layer', 'form','laypage','laytpl','laydate'], function () {
        var laypage = layui.laypage,laytpl = layui.laytpl;
        laydate = layui.laydate;
        form = layui.form();
        $ = layui.jquery;
        layer=layui.layer;
        var pagelistdate;
        var sitelist={:json_encode($sitelist)};
        var curr;
        form.render();



        laypage({
            cont: 'page',
            pages: parseInt('{$page|default=1}') //总页数
            ,
            groups: 5 //连续显示分页数
            ,
            jump: function(obj, first) {
                curr = obj.curr;
                listcontent.innerHTML='';
                $.ajax({
                    type: "GET",
                    url: "",
                    data: {
                        p:curr
                    },
                    async: false,
                    success: function(date){
                        if(date.code==101){
                            layui.each(date.data,function(k,v){
                                var getTpl = listtpl.innerHTML;
                                laytpl(getTpl).render(v, function(html){
                                    listcontent.innerHTML += html;
                                });
                            });
                        }
                    }
                });
                caozuo();
            }
        });


        $('.exceladd').click(function(){
            var url = "{:U('MyTeam/remarkUserAdd')}";
            $.get(url,function(data){
                if(data.code == '4001'){
                    layer.msg(data.msg,{icon: 5});
                    return;
                }
                layer.open({
                    title:'excel导入注册成功用户',
                    type: 1,
                    skin: 'layui-layer-rim',
                    area: ['500px'],
                    content: data
                });
            });
        });
        $('.unlock').click(function(){
            var url = "{:U('MyTeam/unlock')}";
            layer.confirm('确认批量操作吗', {
                btn: ['释放用户','失效账号检测', '取消'] //可以无限个按钮
                ,yes: function(index, layero){
                    $.post(url, function(data){
                        if(data.code=="101"){
                            layer.msg(data.msg,{icon: 6,time: 2000});
                            window.location.reload();
                        }else {
                            // layer.close(index);
                            layer.msg(data.msg,{icon: 5,time: 2000});
                        }
                    });
                },btn2: function(index, layero){
                    var url = "{:U('MyTeam/checkaccount')}";
                    $.post(url, function(data){
                        if(data.code=="101"){
                            layer.msg(data.msg,{icon: 6,time: 2000});
                            window.location.reload();
                        }else {
                            // layer.close(index);
                            layer.msg(data.msg,{icon: 5,time: 2000});
                        }
                    });
                }
            })
        });
        $('.register').click(function(){
            var url = "{:U('MyTeam/accountRegister')}";
            $.get(url,function(data){
                if(data.code == '4001'){
                    layer.msg(data.msg,{icon: 5});
                    return;
                }
                layer.open({
                    title:'发布注册任务',
                    type: 1,
                    skin: 'layui-layer-rim',
                    area: ['400px','400px'],
                    content: data
                });
            });
        });
        $('.produce').click(function(){
            var url = "{:U('MyTeam/accountProduce')}";
            $.get(url,function(data){
                if(data.code == '4001'){
                    layer.msg(data.msg,{icon: 5});
                    return;
                }
                layer.open({
                    title:'批量注册用户',
                    type: 1,
                    skin: 'layui-layer-rim',
                    area: ['700px'],
                    content: data
                });
            });

        });



        function caozuo(){
           /* $('.edit').on('click',function () {
                var id = $(this).attr('data');
                var url = "{:U('DealerMember/edit')}";
                $.get(url, {id: id}, function (data) {
                    if (data.status == 'error') {
                        layer.msg(data.msg, {icon: 5});
                    }
                    layer.open({
                        title: '编辑管理员信息',
                        type: 1,
                        skin: 'layui-layer-rim',
                        area: ['800px', '500px;'],
                        content: data,
                    });
                });
            });*/
        }

    });
</script>
</body>
</html>